package org.glutenberg.util;

import java.util.Enumeration;
import java.util.Vector;

public class CollectionUtils {
	
	public static Vector fromEnumerationToVector(Enumeration enumeration){
		Vector ret = new Vector();
		while(enumeration.hasMoreElements()){
			ret.addElement(enumeration.nextElement());
		}
		return ret;
	}
	
	public static int compareVectors(Vector v1, Vector v2, Comparator comparator){
		for(int i=0;i<v1.size();i++){
			Object o1 = v1.elementAt(i);
			if(v2.size()<=i) return 1;
			else {
				Object o2 = v2.elementAt(i);
				int comp = comparator.compare(o1, o2);
				if(comp!=0) return comp;
			}
		}
		return 0;
	}
}
